package com.ocom.payconfig.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ocom.common.entity.payconfig.EntitySubsidyData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IDaoSubsidyData extends BaseMapper<EntitySubsidyData> {

    @Select({"<script>",
            "select  p.p_id,s.plan_money \n" +
                    "FROM subsidy_data s INNER JOIN personnel_info p ON s.p_id = p.p_id \n" +
                    "where s.com_id=#{comId} " +
                    "and s.plan_id = #{planId} " +
                    "and p.status = 0 " +
                    "and s.wallet = #{wallet} " +
                    "</script>"})
    public List<EntitySubsidyData> oldData(@Param("comId") Long comId,@Param("planId") Integer planId,@Param("wallet") Integer wallet);


    @Select({"<script>",
            "select  p.p_name,p.p_code,d.dept_name,p.dept_id,s.* \n" +
                    "FROM subsidy_data s left JOIN personnel_info p ON s.p_id = p.p_id left JOIN dept_info d ON d.dept_id = p.dept_id \n" +
                    "where s.data_status=1 " +
                    "and s.plan_id = #{planId} " +
//                    "and s.plan_money &lt;&gt; 0 " +
                    "</script>"})
    public List<EntitySubsidyData> StaySubsidyData(@Param("planId") Integer planId);
}
